package java67_adv9;

import java.net.*;
import java.util.Scanner;
import java.io.*;

public class TalkerClient {// 47.93.151.29
	public static void main(String[] args) throws IOException {
		Scanner input = new Scanner(System.in);

		Socket s = new Socket("192.168.1.146", 9999);
		// Socket s = new Socket("47.93.151.29", 9999);
		InputStream in = s.getInputStream();
		OutputStream out = s.getOutputStream();
		BufferedReader br = new BufferedReader(new InputStreamReader(in));
		PrintWriter pw = new PrintWriter(out);// ?
		String words = null;
		while (true) {
			System.out.print("想说:");
			words = input.next();
			pw.println(words);
			pw.flush();
			String reply = br.readLine();
			System.out.println("服务器说:" + reply);
			if (words.equalsIgnoreCase("quit"))
				break;
		}
		s.close();
	}
}
